/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author HoangHai
 */
@Entity
@Table(name = "Student")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Student.findAll", query = "SELECT s FROM Student s"),
    @NamedQuery(name = "Student.findByStuID", query = "SELECT s FROM Student s WHERE s.stuID = :stuID"),
    @NamedQuery(name = "Student.findByStuName", query = "SELECT s FROM Student s WHERE s.stuName = :stuName"),
    @NamedQuery(name = "Student.findByStuBirthday", query = "SELECT s FROM Student s WHERE s.stuBirthday = :stuBirthday"),
    @NamedQuery(name = "Student.findByStuSex", query = "SELECT s FROM Student s WHERE s.stuSex = :stuSex"),
    @NamedQuery(name = "Student.findByStuAddress", query = "SELECT s FROM Student s WHERE s.stuAddress = :stuAddress"),
    @NamedQuery(name = "Student.findByStuPhone", query = "SELECT s FROM Student s WHERE s.stuPhone = :stuPhone"),
    @NamedQuery(name = "Student.findByStuEmail", query = "SELECT s FROM Student s WHERE s.stuEmail = :stuEmail")})
public class Student implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 5)
    @Column(name = "StuID")
    private String stuID;
    @Size(max = 50)
    @Column(name = "StuName")
    private String stuName;
    @Column(name = "StuBirthday")
    @Temporal(TemporalType.TIMESTAMP)
    private Date stuBirthday;
    @Column(name = "StuSex")
    private Integer stuSex;
    @Size(max = 50)
    @Column(name = "StuAddress")
    private String stuAddress;
    @Size(max = 50)
    @Column(name = "StuPhone")
    private String stuPhone;
    @Size(max = 50)
    @Column(name = "StuEmail")
    private String stuEmail;
    @OneToMany(mappedBy = "stuID")
    private List<StuDetail> stuDetailList;
    @OneToMany(mappedBy = "stuID")
    private List<ReEvaluation> reEvaluationList;

    public Student() {
    }

    public Student(String stuID) {
        this.stuID = stuID;
    }

    public String getStuID() {
        return stuID;
    }

    public void setStuID(String stuID) {
        this.stuID = stuID;
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public Date getStuBirthday() {
        return stuBirthday;
    }

    public void setStuBirthday(Date stuBirthday) {
        this.stuBirthday = stuBirthday;
    }

    public Integer getStuSex() {
        return stuSex;
    }

    public void setStuSex(Integer stuSex) {
        this.stuSex = stuSex;
    }

    public String getStuAddress() {
        return stuAddress;
    }

    public void setStuAddress(String stuAddress) {
        this.stuAddress = stuAddress;
    }

    public String getStuPhone() {
        return stuPhone;
    }

    public void setStuPhone(String stuPhone) {
        this.stuPhone = stuPhone;
    }

    public String getStuEmail() {
        return stuEmail;
    }

    public void setStuEmail(String stuEmail) {
        this.stuEmail = stuEmail;
    }

    @XmlTransient
    public List<StuDetail> getStuDetailList() {
        return stuDetailList;
    }

    public void setStuDetailList(List<StuDetail> stuDetailList) {
        this.stuDetailList = stuDetailList;
    }

    @XmlTransient
    public List<ReEvaluation> getReEvaluationList() {
        return reEvaluationList;
    }

    public void setReEvaluationList(List<ReEvaluation> reEvaluationList) {
        this.reEvaluationList = reEvaluationList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (stuID != null ? stuID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Student)) {
            return false;
        }
        Student other = (Student) object;
        if ((this.stuID == null && other.stuID != null) || (this.stuID != null && !this.stuID.equals(other.stuID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Student[ stuID=" + stuID + " ]";
    }
    
}
